/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package org.taobao.ibatiside.model.mapperv3.impl;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

import org.taobao.ibatiside.model.mapperv3.Collection;
import org.taobao.ibatiside.model.mapperv3.Foreach;
import org.taobao.ibatiside.model.mapperv3.Mapperv3Package;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Foreach</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link org.taobao.ibatiside.model.mapperv3.impl.ForeachImpl#getClose <em>Close</em>}</li>
 *   <li>{@link org.taobao.ibatiside.model.mapperv3.impl.ForeachImpl#getCollection <em>Collection</em>}</li>
 *   <li>{@link org.taobao.ibatiside.model.mapperv3.impl.ForeachImpl#getIndex <em>Index</em>}</li>
 *   <li>{@link org.taobao.ibatiside.model.mapperv3.impl.ForeachImpl#getItem <em>Item</em>}</li>
 *   <li>{@link org.taobao.ibatiside.model.mapperv3.impl.ForeachImpl#getOpen <em>Open</em>}</li>
 *   <li>{@link org.taobao.ibatiside.model.mapperv3.impl.ForeachImpl#getSeparator <em>Separator</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class ForeachImpl extends CommonNestedStatementImpl implements Foreach {
	/**
	 * The default value of the '{@link #getClose() <em>Close</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getClose()
	 * @generated
	 * @ordered
	 */
	protected static final String CLOSE_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getClose() <em>Close</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getClose()
	 * @generated
	 * @ordered
	 */
	protected String close = CLOSE_EDEFAULT;

	/**
	 * The cached value of the '{@link #getCollection() <em>Collection</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getCollection()
	 * @generated
	 * @ordered
	 */
	protected Collection collection;

	/**
	 * The default value of the '{@link #getIndex() <em>Index</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getIndex()
	 * @generated
	 * @ordered
	 */
	protected static final String INDEX_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getIndex() <em>Index</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getIndex()
	 * @generated
	 * @ordered
	 */
	protected String index = INDEX_EDEFAULT;

	/**
	 * The default value of the '{@link #getItem() <em>Item</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getItem()
	 * @generated
	 * @ordered
	 */
	protected static final String ITEM_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getItem() <em>Item</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getItem()
	 * @generated
	 * @ordered
	 */
	protected String item = ITEM_EDEFAULT;

	/**
	 * The default value of the '{@link #getOpen() <em>Open</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getOpen()
	 * @generated
	 * @ordered
	 */
	protected static final String OPEN_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getOpen() <em>Open</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getOpen()
	 * @generated
	 * @ordered
	 */
	protected String open = OPEN_EDEFAULT;

	/**
	 * The default value of the '{@link #getSeparator() <em>Separator</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getSeparator()
	 * @generated
	 * @ordered
	 */
	protected static final String SEPARATOR_EDEFAULT = null;

	/**
	 * The cached value of the '{@link #getSeparator() <em>Separator</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getSeparator()
	 * @generated
	 * @ordered
	 */
	protected String separator = SEPARATOR_EDEFAULT;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected ForeachImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return Mapperv3Package.Literals.FOREACH;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getClose() {
		return close;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setClose(String newClose) {
		String oldClose = close;
		close = newClose;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, Mapperv3Package.FOREACH__CLOSE, oldClose, close));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Collection getCollection() {
		return collection;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setCollection(Collection newCollection) {
		Collection oldCollection = collection;
		collection = newCollection;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, Mapperv3Package.FOREACH__COLLECTION, oldCollection, collection));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getIndex() {
		return index;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setIndex(String newIndex) {
		String oldIndex = index;
		index = newIndex;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, Mapperv3Package.FOREACH__INDEX, oldIndex, index));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getItem() {
		return item;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setItem(String newItem) {
		String oldItem = item;
		item = newItem;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, Mapperv3Package.FOREACH__ITEM, oldItem, item));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getOpen() {
		return open;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setOpen(String newOpen) {
		String oldOpen = open;
		open = newOpen;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, Mapperv3Package.FOREACH__OPEN, oldOpen, open));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String getSeparator() {
		return separator;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setSeparator(String newSeparator) {
		String oldSeparator = separator;
		separator = newSeparator;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, Mapperv3Package.FOREACH__SEPARATOR, oldSeparator, separator));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case Mapperv3Package.FOREACH__CLOSE:
				return getClose();
			case Mapperv3Package.FOREACH__COLLECTION:
				return getCollection();
			case Mapperv3Package.FOREACH__INDEX:
				return getIndex();
			case Mapperv3Package.FOREACH__ITEM:
				return getItem();
			case Mapperv3Package.FOREACH__OPEN:
				return getOpen();
			case Mapperv3Package.FOREACH__SEPARATOR:
				return getSeparator();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case Mapperv3Package.FOREACH__CLOSE:
				setClose((String)newValue);
				return;
			case Mapperv3Package.FOREACH__COLLECTION:
				setCollection((Collection)newValue);
				return;
			case Mapperv3Package.FOREACH__INDEX:
				setIndex((String)newValue);
				return;
			case Mapperv3Package.FOREACH__ITEM:
				setItem((String)newValue);
				return;
			case Mapperv3Package.FOREACH__OPEN:
				setOpen((String)newValue);
				return;
			case Mapperv3Package.FOREACH__SEPARATOR:
				setSeparator((String)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case Mapperv3Package.FOREACH__CLOSE:
				setClose(CLOSE_EDEFAULT);
				return;
			case Mapperv3Package.FOREACH__COLLECTION:
				setCollection((Collection)null);
				return;
			case Mapperv3Package.FOREACH__INDEX:
				setIndex(INDEX_EDEFAULT);
				return;
			case Mapperv3Package.FOREACH__ITEM:
				setItem(ITEM_EDEFAULT);
				return;
			case Mapperv3Package.FOREACH__OPEN:
				setOpen(OPEN_EDEFAULT);
				return;
			case Mapperv3Package.FOREACH__SEPARATOR:
				setSeparator(SEPARATOR_EDEFAULT);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case Mapperv3Package.FOREACH__CLOSE:
				return CLOSE_EDEFAULT == null ? close != null : !CLOSE_EDEFAULT.equals(close);
			case Mapperv3Package.FOREACH__COLLECTION:
				return collection != null;
			case Mapperv3Package.FOREACH__INDEX:
				return INDEX_EDEFAULT == null ? index != null : !INDEX_EDEFAULT.equals(index);
			case Mapperv3Package.FOREACH__ITEM:
				return ITEM_EDEFAULT == null ? item != null : !ITEM_EDEFAULT.equals(item);
			case Mapperv3Package.FOREACH__OPEN:
				return OPEN_EDEFAULT == null ? open != null : !OPEN_EDEFAULT.equals(open);
			case Mapperv3Package.FOREACH__SEPARATOR:
				return SEPARATOR_EDEFAULT == null ? separator != null : !SEPARATOR_EDEFAULT.equals(separator);
		}
		return super.eIsSet(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String toString() {
		if (eIsProxy()) return super.toString();

		StringBuffer result = new StringBuffer(super.toString());
		result.append(" (close: ");
		result.append(close);
		result.append(", index: ");
		result.append(index);
		result.append(", item: ");
		result.append(item);
		result.append(", open: ");
		result.append(open);
		result.append(", separator: ");
		result.append(separator);
		result.append(')');
		return result.toString();
	}

} //ForeachImpl
